package com.xiyuan.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;

import com.xiyuan.dao.FamilyMapper;
import com.xiyuan.dao.HuiyuanMapper;
import com.xiyuan.dao.PipeiMapper;
import com.xiyuan.dao.ZeouMapper;
import com.xiyuan.entity.Family;
import com.xiyuan.entity.Huiyuan;
import com.xiyuan.entity.HuiyuanSearch;
import com.xiyuan.entity.Zeou;

@Service
public class TxService {

	@Autowired
	private HuiyuanMapper huiyuanMapper;
	@Autowired
	private FamilyMapper familyMapper;
	@Autowired
	private PipeiMapper pipeiMapper;
	@Autowired
	private ZeouMapper zeouMapper;

	@Transactional
	public void deleteHuiyuan(Integer id) {

		huiyuanMapper.deleteByPrimaryKey(id);
		familyMapper.deleteByHyid(id);
		zeouMapper.deleteByHyid(id);

	}
/*	@Transactional(propagation = Propagation.NESTED, timeout = 1000, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
	public void deleteHuiyuan2(Integer id) {
		Huiyuan hy = new Huiyuan();
		hy.setName("names");
		Family fa = new Family();
		fa.setName("names");
		Zeou ze = new Zeou();
		ze.setFangzi("names");
		ze.setHyid(3);
		huiyuanMapper.insertSelective(hy);
		familyMapper.insertSelective(fa);
		int a, b, c;
		a = 2;
		b = 3;
		c = 5;
		if (a + b == c)
			throw new RuntimeException("123");
		zeouMapper.insertSelective(ze);

	}*/



}
